* {
    margin: 0;
    padding: 0;
}

 :root {
    --gradient: linear-gradient(to right, purple, red, orange, yellow, green, cyan, blue, purple, red, orange, yellow, green, cyan, blue, purple);
}

.wrapper {
    width: 800px;
    margin: 100px auto;
}

.text {
    /* 使用背景图做渐变 */
    background: var(--gradient);
    background-size: 200%;
    background-clip: text;
    /* 裁剪背景，只显示文字区域 */
    -webkit-background-clip: text;
    font-family: 'Arial Black';
    font-size: 80px;
    /* 文字颜色透明 */
    color: transparent;
    /* animation: positionChange 2s linear infinite; */
}

.box {
    position: relative;
    left: 0;
    width: 100px;
    height: 100px;
    border: 10px dashed #f00;
    background-clip: padding-box;
    background-image: linear-gradient(to right, red, orange 40%, pink);
    animation: move 2s ease infinite;
}

.bt:checked~.text {
    animation: positionChange 2s linear infinite;
}

@keyframes move {
    from {
        left: 0;
    }
    to {
        left: 500px
    }
}

@keyframes positionChange {
    0% {
        background-position-x: 0%;
    }
    100% {
        background-position-x: 100%;
    }
}